﻿using System.Windows;

namespace FFmpegVideoClip.windows
{
    /// <summary>
    /// InputTextWindow.xaml 的交互逻辑
    /// </summary>
    public partial class InputTextWindow : Window
    {
        public static bool ShowInputTextDialog(Window owner, string Title, out string Result, string Value = "")
        {
            InputTextWindow inputTextWindow = new InputTextWindow();
            inputTextWindow.Owner = owner;
            inputTextWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            inputTextWindow.WindowTitle.Text = Title;
            inputTextWindow.Value.Text = Value;
            if (inputTextWindow.ShowDialog()!.Value)
            {
                Result = inputTextWindow.Value.Text;
                return true;
            }

            Result = null!;
            return false;
        }

        public InputTextWindow()
        {
            InitializeComponent();
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            DialogResult=false;
        }
    }
}
